import { messages } from "share/common";

const pathBindTypeMaps = {
  "/api/users/v3/search": "users",
  "/api/application/participantsList": "users",
  "/api/expense/participantsList": "users",
  "/api/custom/forms/finance/vendorList": "suppliers",
  "/supplier/api/ven/info/by/company": "suppliers",
};

const placeHolders = {
  users: messages("common-1.key1305") /*请通过左侧条件搜索人员*/,
  "users-filter": messages("common-1.key1306") /*请调整左侧条件，重新尝试搜索人员*/,
  suppliers: messages("common-1.key1337") /*暂无数据，请联系管理员维护*/,
};
export default {
  getEmptyText(url, withFilter) {
    console.log("getEmptyText", url, withFilter);
    url = url.split("?")[0];
    let path = Object.keys(pathBindTypeMaps).find((path) => path.indexOf(url) !== -1);
    if (path) {
      let bindType = pathBindTypeMaps[path];
      return withFilter ? placeHolders[`${bindType}-filter`] : placeHolders[bindType];
    }
  },
  hasSearchParams(params) {
    return Object.keys(params).some((key) => params[key]);
  },
};
